@extends('admin.layout')
@section('title',$title)
@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                分类管理
                <small>分类管理</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 后台页面</a></li>
                <li><a href="#">分类管理</a></li>
                <li class="active">分类编辑</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">分类编辑</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        @if(session('error'))
                            {{session('error')}}
                        @endif
                        @if(session('fail'))
                            {{session('fail')}}
                        @endif
                        <form role="form" action="/admin/cate/update" method="post" enctype="multipart/form-data">
                            {{csrf_field()}}
                            <input type="hidden" name="id" value="{{$data -> id}}">
                            <div class="box-body">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">分类名称</label>
                                    <input type="text" name="name" class="form-control" id="exampleInputEmail1" value="{{$data -> name}}"
                                           placeholder="请输入分类名称"> 
                                            
                                </div>
                                <div class="form-group">
                                    <label>父分类</label>
                                    <select name="pid" class="form-control">
                                        <option value="0">商品分类</option>
                                    @foreach($allData as $v)
                                        <option 
                                        @if($data -> pid == $v -> id)
                                            selected
                                        @endif
                                        @if($data -> id == $v -> id)
                                            disabled
                                        @endif
                                        value="{{$v->id}}">{{$v -> name}}</option>
                                    @endforeach   
                                    </select>
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">更新</button>
                                <button type="reset" class="btn btn-primary">重置</button>
                            </div>
                        </form>
                    </div><!-- /.box -->

                    
                </div><!--/.col (left) -->
                <!-- right column -->
                
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection